//
//  ArrOperation.swift
//  swiftStudy
//
//  Created by unisedu on 16/4/1.
//  Copyright © 2016年 CaoFei. All rights reserved.
//

import UIKit
/**
 数组的增删改
 
 本讲介绍了如何通过 append、insert、removeLast、removeAtIndex、removeAll方法添加和删除数组元素，并且解释了isEmpty属性的含义
 */
class ArrOperation: NSObject {
   
    func show(){
        
        //let 是常量，不能改变和追加删除等
        var array = ["aaa","bb","ccc","ddd"]
        
        array.append("xxx")
        print(array)
        
        array.removeLast()
        
        array.removeLast()
        print(array)
        
        array.removeAtIndex(0)
        array.removeAtIndex(0)
        array.removeAtIndex(0)
        print(array.isEmpty)
        print(array)
        array.insert("xyz",atIndex:0)
        print(array)
        array.insert("abc",atIndex:0)
        print(array)
        print(array.isEmpty)
        array.removeAll()
        print(array.isEmpty)
    }
}
